home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Found / BCCollec / Structs / Maps / BCMapU.h < prev   
Encoding:
Text File  |  1994-04-21  |  2.1 KB  |  68 lines  |  [TEXT/MPS ]

  1. //  The C++ Booch Components (Version 2.1)
  2. //  (C) Copyright 1990-1993 Grady Booch. All Rights Reserved.
  3. //
  4. //  BCMapU.h
  5. //
  6. //  This file contains the declaration of the unbounded map.
  7.  
  8. #ifndef BCMAPU_H
  9. #define BCMAPU_H 1
  10.  
  11. #include "BCNodes.h"
  12. #include "BCUnboun.h"
  13. #include "BCHashTa.h"
  14. #include "BCMap.h"
  15.  
  16. // Unbounded map
  17.  
  18. template<class Item, class Value, BC_Index Buckets, class StorageManager>
  19. class BC_TUnboundedMap : public BC_TMap<Item, Value> {
  20. public:
  21.  
  22.   BC_TUnboundedMap();
  23.   BC_TUnboundedMap(BC_Index (*)(const Item&));
  24.   BC_TUnboundedMap(const BC_TUnboundedMap<Item, Value, Buckets, StorageManager>&);
  25.   virtual ~BC_TUnboundedMap();
  26.   
  27.   virtual BC_TMap<Item, Value>& operator=(const BC_TMap<Item, Value>&);
  28.   virtual BC_TMap<Item, Value>& 
  29.     operator=(const BC_TUnboundedMap<Item, Value, Buckets, StorageManager>&);
  30.   virtual BC_Boolean operator==(const BC_TMap<Item, Value>&) const;
  31.   virtual BC_Boolean 
  32.     operator==(const BC_TUnboundedMap<Item, Value, Buckets, StorageManager>&) const;
  33.   BC_Boolean 
  34.     operator!=(const BC_TUnboundedMap<Item, Value, Buckets, StorageManager>&) const;
  35.  
  36.   virtual void SetHashFunction(BC_Index (*)(const Item&));
  37.   virtual void Clear();
  38.   virtual BC_Boolean Bind(const Item&, const Value&);
  39.   virtual BC_Boolean Rebind(const Item&, const Value&);
  40.   virtual BC_Boolean Unbind(const Item&);
  41.  
  42.   virtual BC_Index Extent() const;
  43.   virtual BC_Boolean IsEmpty() const;
  44.   virtual BC_Boolean IsBound(const Item&) const;
  45.   virtual const Value* ValueOf(const Item&) const;
  46.   virtual Value* ValueOf(const Item&);
  47.  
  48.   static void* operator new(size_t);
  49.   static void operator delete(void*, size_t);
  50.  
  51. protected:
  52.  
  53.   BC_TTable<Item, Value, Buckets, BC_TUnbounded<BC_TPair<Item, Value>, StorageManager> > 
  54.     fRep;
  55.  
  56.   virtual void Purge();
  57.   virtual BC_Boolean Attach(const Item&, const Value&);
  58.   virtual BC_Index Cardinality() const;
  59.   virtual BC_Index NumberOfBuckets() const;
  60.   virtual BC_Index Length(BC_Index bucket) const;
  61.   virtual BC_Boolean Exists(const Item&) const;
  62.   virtual const Item& ItemAt(BC_Index bucket, BC_Index index) const;
  63.   virtual const Value& ValueAt(BC_Index bucket, BC_Index index) const;
  64.  
  65. };
  66.  
  67. #endif
  68.